package com.tmall.tmall.mapper;

import com.tmall.tmall.pojo.Advertising;
import com.tmall.tmall.pojo.Slideshow;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdvertisingMapper {
    @Insert("insert into advertising (position, title, link, mainImg, sort, create_time) VALUE (#{position}," +
            "#{title},#{link},#{mainImg},#{sort},#{createTime})")
    void insert(Advertising advertising);

    @Select("select * from advertising where delete_at is null and position=#{position}")
    Advertising getByPosition(Integer position);

    List<Advertising> page(Integer position);

    void update(Advertising advertising);

    @Select("select * from advertising where delete_at is null")
    List<Advertising> selectAll();
}
